package com.zxd.annotation.easy_junit;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.function.Consumer;
import java.util.function.Predicate;

/**
 * ClassName:StartTest
 * Package:com.zxd.annotation.easy_junit
 *
 * @Date:2023/10/8 15:04
 * @Author:zxde
 */
public class StartTest {
    public static void main(String[] args) {
        Class<Util> utilClass = Util.class;

        Method[] declaredMethods = utilClass.getDeclaredMethods();

        Arrays.stream(declaredMethods)
                .filter(method -> method.isAnnotationPresent(MyJunitTest.class))
                .forEach(method -> {
                    method.setAccessible(true);
                    try {
                        method.invoke(new Util());
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                });
    }
}
